<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            margin: 100px auto;
            width: 260px;
        }
        
        .box input {
            width: 200px;
            border: 0;
            border-bottom: 1px solid #ccc;
            color: #999;
        }
    </style>
</head>

<body>
    <div class="box">
        <i>账号：</i>
        <input type="text" name="" id="in1" value="邮箱/ID/手机号">
        <i>密码：</i>
        <input type="password" name="" id="in2" value="">
    </div>
    <script>
        var input = document.getElementById("in1");
        input.onfocus = function() {
            if (this.value == "邮箱/ID/手机号") {
                this.value = "";
            }
            this.style.color = "#ccc";
        }
        input.onblur = function() {
            if (this.value == "") {
                this.value = "邮箱/ID/手机号";
            }
            this.style.color = "#999";
        }
    </script>
</body>

</html>